package thread;

/*
 * @author zzr
 * @date: 2025/03/27  19:41
 * @description:
 */
public class ThreadDemo8 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });

        System.out.println("start 之前 " + t.isAlive());

        t.start();

        System.out.println("start 之后 " + t.isAlive());

        Thread.sleep(2000);
        // 因为在 run 中，只是sleep 1s，2s 之后，线程 t 已经结束了

        System.out.println("t结束之后 " + t.isAlive());
    }
}
